//
//  ViewController.m
//  线程保活
//
//  Created by 崔博 on 2018/8/22.
//  Copyright © 2018年 崔博. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (nonatomic, strong) NSThread * thread;
@property (nonatomic, strong) PermentThread * currentThread;
@property (nonatomic, assign) BOOL isStop;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.currentThread = [[PermentThread alloc] init];
    [self.currentThread run];
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.currentThread executeTask:^{
        NSLog(@"执行任务====%@",[NSThread currentThread]);
    }];
}
- (void)test{
    
}
- (void)dealloc
{
//    NSLog(@"我销毁了");
    [self.currentThread stop];
    self.thread = nil;
    
}
@end
